package xin.val1ant.spring_security_jpa.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import xin.val1ant.spring_security_jpa.domain.User;
import xin.val1ant.spring_security_jpa.repository.UserRepository;

import java.util.List;

@Service
public class UserServiceImpl implements IUserService,UserDetailsService {

    @Autowired
    private UserRepository userRepository;
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return userRepository.findByUsername(username);
    }

    @Override
    public void removeUser(Long id) {

    }

    @Override
    public List<User> listUsers() {
        return null;
    }
}
